package com.mz.servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.json.JSONArray;

import com.mz.base.util.ATTSystem;
import com.mz.entity.SysUsers;
import com.mz.service.sys.SysRoleService;

public class ManageServlet extends HttpServlet {

	private static final long serialVersionUID = 1L;

	public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		SysUsers sessionSysUser = (SysUsers) request.getSession().getAttribute(ATTSystem.KEY_SESSION_LOGIN);
		
		SysRoleService sysRoleService = new SysRoleService();
		JSONArray menuArray = sysRoleService.getRoleMenu(sessionSysUser.getRoleId());
		
		CommonServlet.writer(response, menuArray.toString());
	}
	
	public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		this.doPost(request, response);
	}

	public void init() throws ServletException {}
	
	public ManageServlet() {
		super();
	}

	public void destroy() {
		super.destroy();
	}
}